#include "ServerManager.h"
#include "PythonBindServer.h"
#include <QSharedPointer>

ServerManager &ServerManager::getInstance() {
  static ServerManager instance;
  return instance;
}

QSharedPointer<IPythonBindServer> ServerManager::createPythonBindServer() {
  return QSharedPointer<IPythonBindServer>(new PythonBindServer());
}

QSharedPointer<IPythonBindServer> ServerManager::getDefaultPythonBindServer() {
  if (!m_defaultServer) {
    m_defaultServer = createPythonBindServer();
  }
  return m_defaultServer;
}

ServerManager::ServerManager() {
  // 初始化默认服务器
  m_defaultServer = createPythonBindServer();
}

ServerManager::~ServerManager() {
  // 重置默认服务器
  m_defaultServer.reset();
}